// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
  // 通过航次id获取信息
  getdatabyid (params) {
    return Service.get(
      `/${ServiceName}/api/external/product/queryshipbyid?id=${params}`
    )
  },
  // 查询主列表数据
  gettabledata (params) {
    return Service.get(
      `/${ServiceName}/api/external/product/queryall`,{ params }
    )
  },
  // 查询库号
  querystorehousename () {
    return Service.get(
      `/${ServiceName}/api/external/product/querystorehousename`
    )
  },
  // 新增
  insert (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/product/add`,params
    )
  },
  // 编辑
  updatebyid (params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/product/updatebyid`,params
    )
  },
  // 删除
  deletebyid (params) {
    return Service.delete(
      `/${ServiceName}/api/external/product/deletebyid?id=${params}`
    )
  }
}
export default api
